package com.xlong.wljxprinter.presenter;

import com.spd.lib.mvp.BasePresenter;
import com.spd.print.jx.constant.ParamsConstant;
import com.xlong.wljxprinter.MainActivity;
import com.xlong.wljxprinter.application.BaseApp;
import com.xlong.wljxprinter.contract.MainContract;
import com.xlong.wljxprinter.model.MainModel;

public class MainPresenter extends BasePresenter<MainActivity, MainModel> implements MainContract.Presenter {
    @Override
    protected MainModel createModel() {
        return new MainModel();
    }

    @Override
    public void connectPrinter() {
        BaseApp.getPrinterImpl().connectPrinter(getView());
    }

    @Override
    public void disconnectPrinter() {
        BaseApp.getPrinterImpl().closeConnect();
    }

    public void initPrint(int type, int density) {
        BaseApp.getPrinterImpl().setAllParams(ParamsConstant.paperType(type), ParamsConstant.density(density));
    }

}
